<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ page import="com.fick.hibernate.model.*"%>
<%@ page import="com.fick.hibernate.dao.*"%>
<%@ page import="java.util.*"  %>
<%@ page import="java.text.SimpleDateFormat"%>
<%@ taglib uri="http://fckeditor.net/tags-fckeditor" prefix="FCK"%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>添加信息</title>
<style type="text/css">
body {
	margin-left: 0px;
	margin-top: 0px;
	margin-right: 0px;
	margin-bottom: 0px;
}
.STYLE1 {font-size: 12px;}
.STYLE4 {
	font-size: 12px;
	color: #1F4A65;
	font-weight: bold;
}

a:link {
	font-size: 12px;
	color: #06482a;
	text-decoration: none;

}
a:visited {
	font-size: 12px;
	color: #06482a;
	text-decoration: none;
}
a:hover {
	font-size: 12px;
	color: #FF0000;
	text-decoration: underline;
}
a:active {
	font-size: 12px;
	color: #FF0000;
	text-decoration: none;
}
.STYLE7 {font-size: 12px;}

</style>
<script type="text/javascript" src="meihuaxue.js"></script>
<script type="text/javascript" src="js/datecontrol.js"></script>
<script type="text/javascript" type="text/javascript" src="My97DatePicker/WdatePicker.js" defer="defer"></script>
<script type="text/javascript">

  function showlayer()   {  
     var mylayer = document.getElementById("tress");
           mylayer.style.left   =   event.clientX;   
           mylayer.style.top   =   event.clientY;  

           if   (mylayer.style.visibility=="hidden")   
             {   
                 mylayer.style.visibility="visible";     
             }   
            else   mylayer.style.visibility="hidden";   
          } 
          //得到栏目的名字和ID
          function sa(channelid,lanmuName){
             showlayer();
             document.getElementById("lanmuName").value=lanmuName;
              document.getElementById("channelid").value=channelid;

          }
          function CheckForm() {
          		var fn1 = document.getElementById("files").value;
          		//var fn2 = document.getElementById("files2").value;
          		//var fn3 = document.getElementById("files3").value;
          		
          		document.getElementById("filesname1").value = fn1;
          		//document.getElementById("filesname2").value = fn2;
          		//document.getElementById("filesname3").value = fn3;
          		
	if(document.form1.lanmuName.value=="")
	{
		alert("新闻栏目不能为空！");
		document.form1.lanmuName.focus();
		return false;
	}
	if(document.form1.newName.value=="")
	{
		alert("新闻名称不能为空！");
		document.form1.newName.focus();
		return false;
	}
	if(document.form1.shr.value=="")
	{
		alert("审核人不能为空！");
		document.form1.newName.focus();
		return false;
	}
	if(document.form1.fbr.value=="")
	{
		alert("发布人不能为空！");
		document.form1.newName.focus();
		return false;
	}
	upload.form1.submit();
	return false;
}
</script>
</head>
	<div id="tress"
		style="border: 1px solid #FF9999; width: 200px; background-color: #FFFFFF; visibility: hidden; position: absolute">
		<%Admin admin=(Admin)request.getSession().getAttribute("admin");
		if (admin.getRole().getId() == 3 || admin.getRole().getId() == 5 ) 
		{
		%>
		<script type="text/javascript">
                     var tree = new MzTreeView("tree");
                     tree.setIconPath("TreeView/"); //可用相对路
                     tree.nodes["0_1"] = "text:栏目管理;";
					 <%
					 List channellist=(List)request.getAttribute("channellist");
					 for(int i=0;i<channellist.size();i++)
					 {Channel channel=(Channel)channellist.get(i);

					 %> 
					  
					   tree.nodes["<%=channel.getFatherId()%>_<%=channel.getChannelId()%>"] = "text:<%=channel.getName().replaceAll("'","‘").replaceAll("\"","”")%>;method:sa('<%=channel.getChannelId()%>','<%=channel.getName().replaceAll("'","‘").replaceAll("\"","”")%>')";  
					 <%
					   }
					 %>
					 
				   tree.setTarget("MzMain");
				   document.write(tree.toString());    //亦可用 obj.innerHTML = tree.toString();
				 </script>
             <%}else{%>
                <script language="JavaScript">
                     var tree = new MzTreeView("tree");
                     tree.setIconPath("TreeView/"); //可用相对路
                     tree.nodes["0_1"] = "text:栏目管理;";
					 <%
					 List channellist=(List)request.getAttribute("channellist");
					 for(int i=0;i<channellist.size();i++)
					 {Channel channel=(Channel)channellist.get(i);
					 %> 
					  
					   tree.nodes["1_<%=channel.getChannelId()%>"] = "text:<%=channel.getName().replaceAll("'","‘").replaceAll("\"","”")%>;method:sa('<%=channel.getChannelId()%>','<%=channel.getName().replaceAll("'","‘").replaceAll("\"","”")%>')";  
					 <%
					   }
					 %>
					 
				   tree.setTarget("MzMain");
				   document.write(tree.toString());    //亦可用 obj.innerHTML = tree.toString();
				 </script>
				 <%} %>
         
	</div>



<body>
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td height="30">
    <table width="100%" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td width="15" height="30"><img src="images/tab_03.gif" width="15" height="30" /></td>
        <td width="1101" background="images/tab_05.gif"><img src="images/311.gif" width="16" height="16" />
			<span class="STYLE4">添加信息页面</span></td>
        <td width="281" background="images/tab_05.gif">
        &nbsp;
        </td>
        <td width="14"><img src="images/tab_07.gif" width="14" height="30" /></td>
      </tr>
    </table>
    </td>
  </tr>
  <tr>
    <td>
    <table width="100%" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td width="9" background="images/tab_12.gif">&nbsp;</td>
        <td bgcolor="#f3ffe3">
        <form name="form1" id="form1" action="<%=request.getContextPath()%>/admin/managerNew.do?method=addNews" enctype="MULTIPART/FORM-DATA" method="post" onSubmit="return CheckForm();">	  
	  <table width="98%" border="0" cellpadding="0" cellspacing="1" bgcolor="#D7DFE1">
        <tr>
          <td width="20%" height="30" align="center" valign="middle" bgcolor="#FFFFFF" class="STYLE1">新闻栏目：</td>
          <td height="30" colspan="3" align="left" valign="middle" bgcolor="#FFFFFF" style="padding-left:10px">
          <span style="padding-left:7px">
            <input name="lanmuName" id="lanmuName" type="text" class="ts_box3" readonly>
          </span>
		  <input type="button" value="选择栏目" onclick="showlayer()" />
		  <input type="hidden" value="" id="channelid" name="channelid" />
		  </td>
        </tr>
        <tr>
          <td width="20%" height="30" align="center" valign="middle" bgcolor="#FFFFFF" class="STYLE1">新闻标题：</td>
          <td height="30" colspan="3" align="left" valign="middle" bgcolor="#FFFFFF" style="padding-left:10px"><span style="padding-left:7px">
            <input name="newName" id="newName" maxlength="250" size="50" type="text" class="ts_box4">
          </span></td>
        </tr>
        <tr>
         
         <td width="20%" height="30" align="center" valign="middle" bgcolor="#FFFFFF" class="STYLE1">
				发布时间：
			</td>
         <td height="30" align="left" valign="middle" colspan="3" bgcolor="#FFFFFF" style="padding-left:10px">
         <span style="padding-left:7px">
			<input name="date" id="date" class="Wdate"
				type="text" size="22" value="" readonly 
				onClick="WdatePicker({skin:'default',dateFmt:'yyyy-MM-dd HH:mm:ss',maxDate:'%y-%M-%d'})" />
				</span>
			</td>
        <tr>
			<td  bgcolor="#FFFFFF" align="center" class="STYLE1">发布人：</td>
			<td  bgcolor="#FFFFFF" style="padding-left:17px" class="STYLE1">
<input type="text" name="fbr"><font color="red">*</font>
			审核人：<input type="text" name="shr"><font color="red">*</font>
			</td>
		</tr>
        <tr>
          <td height="320" colspan="4" align="center" valign="middle" bgcolor="#FFFFFF">
		  <FCK:editor id="content" basePath="/admin/fckeditor/" height="400" imageBrowserURL="/admin/fckeditor/editor/filemanager/browser/default/browser.html?Type=Image&Connector=connectors/jsp/connector"
			linkBrowserURL="/admin/fckeditor/editor/filemanager/browser/default/browser.html?Connector=connectors/jsp/connector"
			flashBrowserURL="/admin/fckeditor/editor/filemanager/browser/default/browser.html?Type=Flash&Connector=connectors/jsp/connector"
			imageUploadURL="/admin/fckeditor/editor/filemanager/upload/simpleuploader?Type=Image"
			linkUploadURL="/admin/fckeditor/editor/filemanager/upload/simpleuploader?Type=File"
			flashUploadURL="/admin/fckeditor/editor/filemanager/upload/simpleuploader?Type=Flash">
		</FCK:editor>
		  </td>
        </tr>
        <tr>
          <td width="20%" height="30" align="center" valign="middle" bgcolor="#FFFFFF" class="STYLE1">上传图片：</td>
          <td height="30" colspan="3" align="left" valign="middle" bgcolor="#FFFFFF" style="padding-left:10px"><span style="padding-left:7px">
           <input type="file" name="pics" id="pics"/>
          </span></td>
        </tr>
        <tr>
          <td width="20%" height="30" align="center" valign="middle" bgcolor="#FFFFFF" class="STYLE1">链接文件：</td>
          <td height="30" colspan="3" align="left" valign="middle" bgcolor="#FFFFFF" style="padding-left:10px"><span style="padding-left:7px">
           <input type="file" name="files" id="files" />
           <input type="hidden" name="filesname1"id="filesname1"/>
          </span></td>
        </tr>
        
		<tr>
			 <td width="20%" height="30" align="center" valign="middle" bgcolor="#FFFFFF" class="STYLE1">内容附件：</td>
			 <td bgcolor="#FFFFFF" style="padding-left:17px">
				<INPUT type="hidden" name="attachment" id="attachment" value=""  class="STYLE1">					 
				<iframe name="upload" id="upload" src="selectFile.jsp?field=attachment" width="100%" height="100" scrolling="yes" frameborder="0"></iframe>	
			 </td>
		</tr>
   		
        <tr>
          <td height="30" colspan="4" align="center" valign="middle" bgcolor="#FFFFFF"><span style="padding-left:7px">
            <input type="submit" value="提交" />
			<input type="reset" value="清空" />
          </span></td>
        </tr>
      </table>
</form>
        </td>
        <td width="9" background="images/tab_16.gif">&nbsp;</td>
      </tr>
    </table>
    </td>
  </tr>
  <tr>
    <td height="29">
    <table width="100%" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td width="15" height="29"><img src="images/tab_20.gif" width="15" height="29" /></td>
        <td background="images/tab_21.gif">
        &nbsp;</td>
        <td width="14"><img src="images/tab_22.gif" width="14" height="29" /></td>
      </tr>
    </table></td>
  </tr>
</table>
</body>
</html>
<script type="text/javascript">
<!--
var message = "<%=session.getAttribute("message")%>";
if(message!=null && message!="null" && message !=""){
   alert(message);
  }
//-->
</script>
<%
	session.removeAttribute("message");
%>